import api from '../../api';
import { message } from 'antd';
export default {
  namespace: 'capitalDetailsM',

  state: {
    typeData: [],
    tableData: { data: { columns: [], dataSource: [], pageInfo: { currentPage: 1, numInPage: 20, total: 0 } } },
  },

  effects: {
    //查询数据
    *getSearch({ payload }, { call, put }) {
      const res = yield call(api.capitalDetails.getSearch, payload);
      if (res) {
        if (res.code == 0) {
          yield put({
            type: 'save',
            payload: {
              tableData: res,
            },
          });
        } else {
          message.warning(res.message);
        }
      } else {
        message.warning('查询失败');
      }
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
